<%@ page contentType="text/html; charset=utf-8" %>

<%@ include file="/WEB-INF/jsp/includeTop.jsp" %>
<%@ include file="/WEB-INF/jsp/includeTaglib.jsp" %>


<form:form commandName="userForm">
<table width="100%" border="0" cellpadding="0" cellspacing="5">
  <tr>
    <td valign="top">
      <table class="dbborder" width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td valign="bottom" class="blueTableBg">&nbsp;配置管理&nbsp;-&nbsp;新增账号</td>
        </tr>
        <tr>
          <td>
            <table width="100%" border="0" cellpadding="0" cellspacing="5">
              <tr>
                <td>
                  <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td class="dashTopLeft"><img src="images/spacer.gif" width="7" height="7"></td>
                      <td class="dashTop" width=100%><img src="images/spacer.gif" width="7" height="7"></td>
                      <td class="dashTopRight"><img src="images/spacer.gif" width="7" height="7"></td>
                    </tr>
                    <tr>
                      <td class="dashLeft"><img src="images/spacer.gif" width="7" height="7"></td>
                      <td align="center">
                        <table width="100%" border="0" cellpadding="0" cellspacing="3">
                          <tr>
                            <td width="114" height="20" class="globalText">帐号</td>
                            <td height="20" class="globalText">
                            	<input id="loginName" type="text" class="txtbox" size="20" name="loginName" value="${loginName}"/>
                            </td>
                          </tr>
                          <tr>
                            <td width="114" height="20" class="globalText">密码</td>
                            <td height="20" class="globalText">
                            	<input id="password" type="password" class="txtbox" size="20" name="password" value="" />
                            </td>
                          </tr>
                          <tr>
                            <td width="114" height="20" class="globalText">角色</td>
                            <td height="20" class="globalText">
															<form:select path="roleIdSlt">
							               		<form:option value="-1" label="-请选择-"/>
							               		<form:options items="${userForm.roles}" itemValue="id" itemLabel="name" />
						               		</form:select>
                            </td>
                          </tr>
                          <tr>
                            <td align="center" colspan="2">
                              <table border="0" cellpadding="0" cellspacing="2">
                                <tr>
                                  <td><input type="button" name="saveBtn" class="btnStyle" value="  保存  "></td>
                                </tr>
                              </table>
                            </td>
                          </tr>
                        </table>
                      </td>
                      <td class="dashRight"><img src="images/spacer.gif" width="7" height="7"></td>
                    </tr>
                    <tr>
                      <td class="dashBottomLeft"><img src="images/spacer.gif" width="7" height="7"></td>
                      <td class="dashBottom" width=100%><img src="images/spacer.gif" width="7" height="7"></td>
                      <td class="dashBottomRight"><img src="images/spacer.gif" width="7" height="7"></td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</form:form>

<script type="text/javascript">
$(document).ready(function() {
    var userForm = $("form[id=userForm]");
    var saveBtn = userForm.find(":button[name=saveBtn]");

    saveBtn.click(function() {
    	document.getElementById("userForm").action="<c:url value='doregister.html' />";
    	document.getElementById("userForm").method="post";
    	
		  var loginName = document.getElementById("loginName").value.trim();
			if (validateEmpty(loginName)) {
				alert("帐号 不能为空");
				return false;
			}

	   var password = document.getElementById("password").value.trim();
		 if (validateEmpty(password)) {
				alert("密码 不能为空");
				return false;
		 }
		 
		 userForm.submit();
    });
});
</script>